﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Utility.Persistence_Service_Test.Entities
{
    public class Kinosaal
    {
        public virtual int Id { get; protected set; }

        public virtual int Nummer { get; set; }

        public virtual decimal GrößeInQM { get; set; }

        public virtual IList<Kinokarte> Kinokarten { get; set; }

        public Kinosaal()
        {
            Kinokarten = new List<Kinokarte>();
        }

        public virtual void AddKinokarte(Kinokarte kinokarte)
        {
            kinokarte.Kinosaal = this;
            Kinokarten.Add(kinokarte);
        }

        public override bool Equals(System.Object obj)
        {
            if (obj == null)
            {
                return false;
            }

            if (GetType() != obj.GetType())
            {
                return false;
            }

            Kinosaal kino = (Kinosaal)obj;

            return (Id.Equals(kino.Id)) && (Nummer.Equals(kino.Nummer)) &&
                (GrößeInQM.Equals(kino.GrößeInQM));
        }

        public override int GetHashCode()
        {    
            int prime = 31;
            int result = 1;
            result = prime * result + Id.GetHashCode();
            result = prime * result + Nummer.GetHashCode();
            result = prime * result + GrößeInQM.GetHashCode();
            return result;
        }

        public override string ToString()
        {
            return "Kinosaal: {Id: " + this.Id.ToString() + ", Nummer: " + this.Nummer.ToString() +
                ", GrößeInQM: " + this.GrößeInQM.ToString() + "}";
        }
    }
}
